using System;
using System.Linq;
using System.Runtime.Serialization;
using System.Data.Objects.DataClasses;
using System.Xml.Serialization;
using System.ComponentModel;
using System.Collections.Generic;
using System.Data.Objects;
using System.Text;
using Acme.Northwind.EFDAL;
using nHydrate.EFCore.DataAccess;
using nHydrate.EFCore.EventArgs;
using System.Text.RegularExpressions;
using System.Linq.Expressions;
using System.Data.Linq;

namespace Acme.Northwind.EFDAL.Entity
{
	/// <summary>
	/// The collection to hold 'OrdersQry' entities
	/// </summary>
	[EdmEntityTypeAttribute(NamespaceName="Acme.Northwind.EFDAL.Entity", Name="OrdersQry")]
	[Serializable()]
	[DataContractAttribute(IsReference = true)]
	[nHydrate.EFCore.Attributes.FieldNameConstantsAttribute(typeof(Acme.Northwind.EFDAL.Entity.OrdersQry.FieldNameConstants))]
	[System.ComponentModel.ImmutableObject(true)]
	[System.CodeDom.Compiler.GeneratedCode("nHydrateModelGenerator", "5.0.1.100")]
	public partial class OrdersQry : nHydrate.EFCore.DataAccess.NHEntityObject, nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject, Acme.Northwind.EFDAL.Interfaces.Entity.IOrdersQry, System.IEquatable<Acme.Northwind.EFDAL.Interfaces.Entity.IOrdersQry>
	{
		#region FieldNameConstants Enumeration

		/// <summary>
		/// Enumeration to define each property that maps to a database field for the 'OrdersQry' customView.
		/// </summary>
		public enum FieldNameConstants
		{
			/// <summary>
			/// Field mapping for the 'Address' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'Address' property")]
			Address,
			/// <summary>
			/// Field mapping for the 'City' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'City' property")]
			City,
			/// <summary>
			/// Field mapping for the 'CompanyName' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'CompanyName' property")]
			CompanyName,
			/// <summary>
			/// Field mapping for the 'Country' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'Country' property")]
			Country,
			/// <summary>
			/// Field mapping for the 'CustomerID' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'CustomerID' property")]
			CustomerID,
			/// <summary>
			/// Field mapping for the 'EmployeeID' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'EmployeeID' property")]
			EmployeeID,
			/// <summary>
			/// Field mapping for the 'Freight' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'Freight' property")]
			Freight,
			/// <summary>
			/// Field mapping for the 'OrderDate' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'OrderDate' property")]
			OrderDate,
			/// <summary>
			/// Field mapping for the 'OrderID' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'OrderID' property")]
			OrderID,
			/// <summary>
			/// Field mapping for the 'PostalCode' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'PostalCode' property")]
			PostalCode,
			/// <summary>
			/// Field mapping for the 'Region' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'Region' property")]
			Region,
			/// <summary>
			/// Field mapping for the 'RequiredDate' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'RequiredDate' property")]
			RequiredDate,
			/// <summary>
			/// Field mapping for the 'ShipAddress' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'ShipAddress' property")]
			ShipAddress,
			/// <summary>
			/// Field mapping for the 'ShipCity' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'ShipCity' property")]
			ShipCity,
			/// <summary>
			/// Field mapping for the 'ShipCountry' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'ShipCountry' property")]
			ShipCountry,
			/// <summary>
			/// Field mapping for the 'ShipName' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'ShipName' property")]
			ShipName,
			/// <summary>
			/// Field mapping for the 'ShippedDate' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'ShippedDate' property")]
			ShippedDate,
			/// <summary>
			/// Field mapping for the 'ShipPostalCode' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'ShipPostalCode' property")]
			ShipPostalCode,
			/// <summary>
			/// Field mapping for the 'ShipRegion' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'ShipRegion' property")]
			ShipRegion,
			/// <summary>
			/// Field mapping for the 'ShipVia' property
			/// </summary>
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'ShipVia' property")]
			ShipVia,
		}
		#endregion

		#region Constructors

		/// <summary>
		/// Initializes a new instance of the Acme.Northwind.EFDAL.Entity.OrdersQry class
		/// </summary>
		protected internal OrdersQry()
		{
		}

		#endregion

		#region Properties

		[System.ComponentModel.Browsable(false)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = true, IsNullable = false)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("pk")]
		[System.ComponentModel.ReadOnly(true)]
		private Guid pk
		{
			get { return _pk; }
			set { _pk = value; }
		}
		private Guid _pk;

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("Address")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual string Address
		{
			get { return _address; }
			set
			{
				if ((value != null) && (value.Length > GetMaxLength(FieldNameConstants.Address))) throw new Exception(string.Format(GlobalValues.ERROR_DATA_TOO_BIG, value, "OrdersQry.Address", GetMaxLength(FieldNameConstants.Address)));
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "Address");
				//this.OnAddressChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("Address");
				_address = eventArg.Value;
				ReportPropertyChanged("Address");
				//this.OnAddressChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("City")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual string City
		{
			get { return _city; }
			set
			{
				if ((value != null) && (value.Length > GetMaxLength(FieldNameConstants.City))) throw new Exception(string.Format(GlobalValues.ERROR_DATA_TOO_BIG, value, "OrdersQry.City", GetMaxLength(FieldNameConstants.City)));
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "City");
				//this.OnCityChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("City");
				_city = eventArg.Value;
				ReportPropertyChanged("City");
				//this.OnCityChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("CompanyName")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual string CompanyName
		{
			get { return _companyName; }
			set
			{
				if ((value != null) && (value.Length > GetMaxLength(FieldNameConstants.CompanyName))) throw new Exception(string.Format(GlobalValues.ERROR_DATA_TOO_BIG, value, "OrdersQry.CompanyName", GetMaxLength(FieldNameConstants.CompanyName)));
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "CompanyName");
				//this.OnCompanyNameChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("CompanyName");
				_companyName = eventArg.Value;
				ReportPropertyChanged("CompanyName");
				//this.OnCompanyNameChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("Country")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual string Country
		{
			get { return _country; }
			set
			{
				if ((value != null) && (value.Length > GetMaxLength(FieldNameConstants.Country))) throw new Exception(string.Format(GlobalValues.ERROR_DATA_TOO_BIG, value, "OrdersQry.Country", GetMaxLength(FieldNameConstants.Country)));
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "Country");
				//this.OnCountryChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("Country");
				_country = eventArg.Value;
				ReportPropertyChanged("Country");
				//this.OnCountryChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("CustomerID")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual string CustomerID
		{
			get { return _customerID; }
			set
			{
				if ((value != null) && (value.Length > GetMaxLength(FieldNameConstants.CustomerID))) throw new Exception(string.Format(GlobalValues.ERROR_DATA_TOO_BIG, value, "OrdersQry.CustomerID", GetMaxLength(FieldNameConstants.CustomerID)));
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "CustomerID");
				//this.OnCustomerIDChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("CustomerID");
				_customerID = eventArg.Value;
				ReportPropertyChanged("CustomerID");
				//this.OnCustomerIDChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("EmployeeID")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual int? EmployeeID
		{
			get { return _employeeID; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int?>(value, "EmployeeID");
				//this.OnEmployeeIDChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("EmployeeID");
				_employeeID = eventArg.Value;
				ReportPropertyChanged("EmployeeID");
				//this.OnEmployeeIDChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("Freight")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual decimal? Freight
		{
			get { return _freight; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<decimal?>(value, "Freight");
				//this.OnFreightChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("Freight");
				_freight = eventArg.Value;
				ReportPropertyChanged("Freight");
				//this.OnFreightChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("OrderDate")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual DateTime? OrderDate
		{
			get { return _orderDate; }
			set
			{
				if ((value != null) && (value < GlobalValues.MIN_DATETIME)) throw new Exception("The DateTime value 'OrderDate' (" + value.Value.ToString("yyyy-MM-dd HH:mm:ss") + ") cannot be less than " + GlobalValues.MIN_DATETIME.ToString());
				if ((value != null) && (value > GlobalValues.MAX_DATETIME)) throw new Exception("The DateTime value 'OrderDate' (" + value.Value.ToString("yyyy-MM-dd HH:mm:ss") + ") cannot be greater than " + GlobalValues.MAX_DATETIME.ToString());
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<DateTime?>(value, "OrderDate");
				//this.OnOrderDateChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("OrderDate");
				_orderDate = eventArg.Value;
				ReportPropertyChanged("OrderDate");
				//this.OnOrderDateChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("OrderID")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual int OrderID
		{
			get { return _orderID; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int>(value, "OrderID");
				//this.OnOrderIDChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("OrderID");
				_orderID = eventArg.Value;
				ReportPropertyChanged("OrderID");
				//this.OnOrderIDChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("PostalCode")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual string PostalCode
		{
			get { return _postalCode; }
			set
			{
				if ((value != null) && (value.Length > GetMaxLength(FieldNameConstants.PostalCode))) throw new Exception(string.Format(GlobalValues.ERROR_DATA_TOO_BIG, value, "OrdersQry.PostalCode", GetMaxLength(FieldNameConstants.PostalCode)));
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "PostalCode");
				//this.OnPostalCodeChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("PostalCode");
				_postalCode = eventArg.Value;
				ReportPropertyChanged("PostalCode");
				//this.OnPostalCodeChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("Region")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual string Region
		{
			get { return _region; }
			set
			{
				if ((value != null) && (value.Length > GetMaxLength(FieldNameConstants.Region))) throw new Exception(string.Format(GlobalValues.ERROR_DATA_TOO_BIG, value, "OrdersQry.Region", GetMaxLength(FieldNameConstants.Region)));
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "Region");
				//this.OnRegionChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("Region");
				_region = eventArg.Value;
				ReportPropertyChanged("Region");
				//this.OnRegionChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("RequiredDate")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual DateTime? RequiredDate
		{
			get { return _requiredDate; }
			set
			{
				if ((value != null) && (value < GlobalValues.MIN_DATETIME)) throw new Exception("The DateTime value 'RequiredDate' (" + value.Value.ToString("yyyy-MM-dd HH:mm:ss") + ") cannot be less than " + GlobalValues.MIN_DATETIME.ToString());
				if ((value != null) && (value > GlobalValues.MAX_DATETIME)) throw new Exception("The DateTime value 'RequiredDate' (" + value.Value.ToString("yyyy-MM-dd HH:mm:ss") + ") cannot be greater than " + GlobalValues.MAX_DATETIME.ToString());
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<DateTime?>(value, "RequiredDate");
				//this.OnRequiredDateChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("RequiredDate");
				_requiredDate = eventArg.Value;
				ReportPropertyChanged("RequiredDate");
				//this.OnRequiredDateChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("ShipAddress")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual string ShipAddress
		{
			get { return _shipAddress; }
			set
			{
				if ((value != null) && (value.Length > GetMaxLength(FieldNameConstants.ShipAddress))) throw new Exception(string.Format(GlobalValues.ERROR_DATA_TOO_BIG, value, "OrdersQry.ShipAddress", GetMaxLength(FieldNameConstants.ShipAddress)));
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "ShipAddress");
				//this.OnShipAddressChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("ShipAddress");
				_shipAddress = eventArg.Value;
				ReportPropertyChanged("ShipAddress");
				//this.OnShipAddressChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("ShipCity")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual string ShipCity
		{
			get { return _shipCity; }
			set
			{
				if ((value != null) && (value.Length > GetMaxLength(FieldNameConstants.ShipCity))) throw new Exception(string.Format(GlobalValues.ERROR_DATA_TOO_BIG, value, "OrdersQry.ShipCity", GetMaxLength(FieldNameConstants.ShipCity)));
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "ShipCity");
				//this.OnShipCityChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("ShipCity");
				_shipCity = eventArg.Value;
				ReportPropertyChanged("ShipCity");
				//this.OnShipCityChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("ShipCountry")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual string ShipCountry
		{
			get { return _shipCountry; }
			set
			{
				if ((value != null) && (value.Length > GetMaxLength(FieldNameConstants.ShipCountry))) throw new Exception(string.Format(GlobalValues.ERROR_DATA_TOO_BIG, value, "OrdersQry.ShipCountry", GetMaxLength(FieldNameConstants.ShipCountry)));
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "ShipCountry");
				//this.OnShipCountryChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("ShipCountry");
				_shipCountry = eventArg.Value;
				ReportPropertyChanged("ShipCountry");
				//this.OnShipCountryChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("ShipName")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual string ShipName
		{
			get { return _shipName; }
			set
			{
				if ((value != null) && (value.Length > GetMaxLength(FieldNameConstants.ShipName))) throw new Exception(string.Format(GlobalValues.ERROR_DATA_TOO_BIG, value, "OrdersQry.ShipName", GetMaxLength(FieldNameConstants.ShipName)));
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "ShipName");
				//this.OnShipNameChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("ShipName");
				_shipName = eventArg.Value;
				ReportPropertyChanged("ShipName");
				//this.OnShipNameChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("ShippedDate")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual DateTime? ShippedDate
		{
			get { return _shippedDate; }
			set
			{
				if ((value != null) && (value < GlobalValues.MIN_DATETIME)) throw new Exception("The DateTime value 'ShippedDate' (" + value.Value.ToString("yyyy-MM-dd HH:mm:ss") + ") cannot be less than " + GlobalValues.MIN_DATETIME.ToString());
				if ((value != null) && (value > GlobalValues.MAX_DATETIME)) throw new Exception("The DateTime value 'ShippedDate' (" + value.Value.ToString("yyyy-MM-dd HH:mm:ss") + ") cannot be greater than " + GlobalValues.MAX_DATETIME.ToString());
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<DateTime?>(value, "ShippedDate");
				//this.OnShippedDateChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("ShippedDate");
				_shippedDate = eventArg.Value;
				ReportPropertyChanged("ShippedDate");
				//this.OnShippedDateChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("ShipPostalCode")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual string ShipPostalCode
		{
			get { return _shipPostalCode; }
			set
			{
				if ((value != null) && (value.Length > GetMaxLength(FieldNameConstants.ShipPostalCode))) throw new Exception(string.Format(GlobalValues.ERROR_DATA_TOO_BIG, value, "OrdersQry.ShipPostalCode", GetMaxLength(FieldNameConstants.ShipPostalCode)));
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "ShipPostalCode");
				//this.OnShipPostalCodeChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("ShipPostalCode");
				_shipPostalCode = eventArg.Value;
				ReportPropertyChanged("ShipPostalCode");
				//this.OnShipPostalCodeChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("ShipRegion")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual string ShipRegion
		{
			get { return _shipRegion; }
			set
			{
				if ((value != null) && (value.Length > GetMaxLength(FieldNameConstants.ShipRegion))) throw new Exception(string.Format(GlobalValues.ERROR_DATA_TOO_BIG, value, "OrdersQry.ShipRegion", GetMaxLength(FieldNameConstants.ShipRegion)));
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "ShipRegion");
				//this.OnShipRegionChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("ShipRegion");
				_shipRegion = eventArg.Value;
				ReportPropertyChanged("ShipRegion");
				//this.OnShipRegionChanged(eventArg);
			}
		}

		/// <summary>
		/// </summary>
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[DataMemberAttribute()]
		[System.ComponentModel.DisplayName("ShipVia")]
		[System.ComponentModel.ReadOnly(true)]
		public virtual int? ShipVia
		{
			get { return _shipVia; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int?>(value, "ShipVia");
				//this.OnShipViaChanging(eventArg);
				if (eventArg.Cancel) return;
				ReportPropertyChanging("ShipVia");
				_shipVia = eventArg.Value;
				ReportPropertyChanged("ShipVia");
				//this.OnShipViaChanged(eventArg);
			}
		}

		#endregion

		#region Events

		/// <summary>
		/// The internal reference variable for the 'Address' property
		/// </summary>
		protected string _address;

		/// <summary>
		/// The internal reference variable for the 'City' property
		/// </summary>
		protected string _city;

		/// <summary>
		/// The internal reference variable for the 'CompanyName' property
		/// </summary>
		protected string _companyName;

		/// <summary>
		/// The internal reference variable for the 'Country' property
		/// </summary>
		protected string _country;

		/// <summary>
		/// The internal reference variable for the 'CustomerID' property
		/// </summary>
		protected string _customerID;

		/// <summary>
		/// The internal reference variable for the 'EmployeeID' property
		/// </summary>
		protected int? _employeeID;

		/// <summary>
		/// The internal reference variable for the 'Freight' property
		/// </summary>
		protected decimal? _freight;

		/// <summary>
		/// The internal reference variable for the 'OrderDate' property
		/// </summary>
		protected DateTime? _orderDate;

		/// <summary>
		/// The internal reference variable for the 'OrderID' property
		/// </summary>
		protected int _orderID;

		/// <summary>
		/// The internal reference variable for the 'PostalCode' property
		/// </summary>
		protected string _postalCode;

		/// <summary>
		/// The internal reference variable for the 'Region' property
		/// </summary>
		protected string _region;

		/// <summary>
		/// The internal reference variable for the 'RequiredDate' property
		/// </summary>
		protected DateTime? _requiredDate;

		/// <summary>
		/// The internal reference variable for the 'ShipAddress' property
		/// </summary>
		protected string _shipAddress;

		/// <summary>
		/// The internal reference variable for the 'ShipCity' property
		/// </summary>
		protected string _shipCity;

		/// <summary>
		/// The internal reference variable for the 'ShipCountry' property
		/// </summary>
		protected string _shipCountry;

		/// <summary>
		/// The internal reference variable for the 'ShipName' property
		/// </summary>
		protected string _shipName;

		/// <summary>
		/// The internal reference variable for the 'ShippedDate' property
		/// </summary>
		protected DateTime? _shippedDate;

		/// <summary>
		/// The internal reference variable for the 'ShipPostalCode' property
		/// </summary>
		protected string _shipPostalCode;

		/// <summary>
		/// The internal reference variable for the 'ShipRegion' property
		/// </summary>
		protected string _shipRegion;

		/// <summary>
		/// The internal reference variable for the 'ShipVia' property
		/// </summary>
		protected int? _shipVia;

		#endregion

		#region GetMaxLength

		/// <summary>
		/// Gets the maximum size of the field value.
		/// </summary>
		public static int GetMaxLength(FieldNameConstants field)
		{
			switch (field)
			{
				case FieldNameConstants.Address:
					return 120;
				case FieldNameConstants.City:
					return 30;
				case FieldNameConstants.CompanyName:
					return 80;
				case FieldNameConstants.Country:
					return 30;
				case FieldNameConstants.CustomerID:
					return 10;
				case FieldNameConstants.EmployeeID:
					return 0;
				case FieldNameConstants.Freight:
					return 0;
				case FieldNameConstants.OrderDate:
					return 0;
				case FieldNameConstants.OrderID:
					return 0;
				case FieldNameConstants.PostalCode:
					return 20;
				case FieldNameConstants.Region:
					return 30;
				case FieldNameConstants.RequiredDate:
					return 0;
				case FieldNameConstants.ShipAddress:
					return 120;
				case FieldNameConstants.ShipCity:
					return 30;
				case FieldNameConstants.ShipCountry:
					return 30;
				case FieldNameConstants.ShipName:
					return 80;
				case FieldNameConstants.ShippedDate:
					return 0;
				case FieldNameConstants.ShipPostalCode:
					return 20;
				case FieldNameConstants.ShipRegion:
					return 30;
				case FieldNameConstants.ShipVia:
					return 0;
			}
			return 0;
		}

		int nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.GetMaxLength(Enum field)
		{
			return GetMaxLength((FieldNameConstants)field);
		}

		#endregion

		#region GetFieldType

		/// <summary>
		/// Gets the system type of a field on this object
		/// </summary>
		public static System.Type GetFieldType(FieldNameConstants field)
		{
			var o = new OrdersQry();
			return ((nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject)o).GetFieldType(field);
		}

		System.Type nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.GetFieldType(Enum field)
		{
			if (field.GetType() != typeof(FieldNameConstants))
				throw new Exception("The '" + field.GetType().ReflectedType.ToString() + ".FieldNameConstants' value is not valid. The field parameter must be of type '" + this.GetType().ToString() + ".FieldNameConstants'.");

			var array = Enum.GetValues(typeof(FieldNameConstants));
			switch ((FieldNameConstants)field)
			{
				case FieldNameConstants.Address: return typeof(string);
				case FieldNameConstants.City: return typeof(string);
				case FieldNameConstants.CompanyName: return typeof(string);
				case FieldNameConstants.Country: return typeof(string);
				case FieldNameConstants.CustomerID: return typeof(string);
				case FieldNameConstants.EmployeeID: return typeof(int?);
				case FieldNameConstants.Freight: return typeof(decimal?);
				case FieldNameConstants.OrderDate: return typeof(DateTime?);
				case FieldNameConstants.OrderID: return typeof(int);
				case FieldNameConstants.PostalCode: return typeof(string);
				case FieldNameConstants.Region: return typeof(string);
				case FieldNameConstants.RequiredDate: return typeof(DateTime?);
				case FieldNameConstants.ShipAddress: return typeof(string);
				case FieldNameConstants.ShipCity: return typeof(string);
				case FieldNameConstants.ShipCountry: return typeof(string);
				case FieldNameConstants.ShipName: return typeof(string);
				case FieldNameConstants.ShippedDate: return typeof(DateTime?);
				case FieldNameConstants.ShipPostalCode: return typeof(string);
				case FieldNameConstants.ShipRegion: return typeof(string);
				case FieldNameConstants.ShipVia: return typeof(int?);
			}
			return null;
		}

		#endregion

		#region GetFieldNameConstants

		System.Type nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.GetFieldNameConstants()
		{
			return typeof(FieldNameConstants);
		}

		#endregion

		#region Get/Set Value

		object nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.GetValue(System.Enum field)
		{
			return ((nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject)this).GetValue(field, null);
		}

		object nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.GetValue(System.Enum field, object defaultValue)
		{
			if (field.GetType() != typeof(FieldNameConstants))
				throw new Exception("The '" + field.GetType().ReflectedType.ToString() + ".FieldNameConstants' value is not valid. The field parameter must be of type '" + this.GetType().ToString() + ".FieldNameConstants'.");
			return this.GetValue((FieldNameConstants)field, defaultValue);
		}

		#endregion

		#region PrimaryKey

		/// <summary>
		/// Hold the primary key for this object
		/// </summary>
		protected nHydrate.EFCore.DataAccess.IPrimaryKey _primaryKey = null;
		nHydrate.EFCore.DataAccess.IPrimaryKey nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.PrimaryKey
		{
			get { return null; }
		}

		#endregion

		#region IsParented

		/// <summary>
		/// Determines if this object is part of a collection or is detached
		/// </summary>
		[System.ComponentModel.Browsable(false)]
		public virtual bool IsParented
		{
		  get { return (this.EntityState != System.Data.EntityState.Detached); }
		}

		#endregion

		#region IsEquivalent

		/// <summary>
		/// Determines if all of the fields for the specified object exactly matches the current object.
		/// </summary>
		/// <param name="item">The object to compare</param>
		public override bool IsEquivalent(nHydrate.EFCore.DataAccess.INHEntityObject item)
		{
			if (item == null) return false;
			if (!(item is Acme.Northwind.EFDAL.Interfaces.Entity.IOrdersQry)) return false;
			var o = item as Acme.Northwind.EFDAL.Interfaces.Entity.IOrdersQry;
			return (
				o.Address == this.Address &&
				o.City == this.City &&
				o.CompanyName == this.CompanyName &&
				o.Country == this.Country &&
				o.CustomerID == this.CustomerID &&
				o.EmployeeID == this.EmployeeID &&
				o.Freight == this.Freight &&
				o.OrderDate == this.OrderDate &&
				o.OrderID == this.OrderID &&
				o.PostalCode == this.PostalCode &&
				o.Region == this.Region &&
				o.RequiredDate == this.RequiredDate &&
				o.ShipAddress == this.ShipAddress &&
				o.ShipCity == this.ShipCity &&
				o.ShipCountry == this.ShipCountry &&
				o.ShipName == this.ShipName &&
				o.ShippedDate == this.ShippedDate &&
				o.ShipPostalCode == this.ShipPostalCode &&
				o.ShipRegion == this.ShipRegion &&
				o.ShipVia == this.ShipVia
				);
		}

		#endregion

		#region Equals
		bool System.IEquatable<Acme.Northwind.EFDAL.Interfaces.Entity.IOrdersQry>.Equals(Acme.Northwind.EFDAL.Interfaces.Entity.IOrdersQry other)
		{
			return this.IsEquivalent(other);
		}
		#endregion

		#region GetValue

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		public object GetValue(FieldNameConstants field)
		{
			return GetValue(field, null);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		public object GetValue(FieldNameConstants field, object defaultValue)
		{
			if (field == FieldNameConstants.Address)
				return ((this.Address == null) ? defaultValue : this.Address);
			if (field == FieldNameConstants.City)
				return ((this.City == null) ? defaultValue : this.City);
			if (field == FieldNameConstants.CompanyName)
				return this.CompanyName;
			if (field == FieldNameConstants.Country)
				return ((this.Country == null) ? defaultValue : this.Country);
			if (field == FieldNameConstants.CustomerID)
				return ((this.CustomerID == null) ? defaultValue : this.CustomerID);
			if (field == FieldNameConstants.EmployeeID)
				return ((this.EmployeeID == null) ? defaultValue : this.EmployeeID);
			if (field == FieldNameConstants.Freight)
				return ((this.Freight == null) ? defaultValue : this.Freight);
			if (field == FieldNameConstants.OrderDate)
				return ((this.OrderDate == null) ? defaultValue : this.OrderDate);
			if (field == FieldNameConstants.OrderID)
				return this.OrderID;
			if (field == FieldNameConstants.PostalCode)
				return ((this.PostalCode == null) ? defaultValue : this.PostalCode);
			if (field == FieldNameConstants.Region)
				return ((this.Region == null) ? defaultValue : this.Region);
			if (field == FieldNameConstants.RequiredDate)
				return ((this.RequiredDate == null) ? defaultValue : this.RequiredDate);
			if (field == FieldNameConstants.ShipAddress)
				return ((this.ShipAddress == null) ? defaultValue : this.ShipAddress);
			if (field == FieldNameConstants.ShipCity)
				return ((this.ShipCity == null) ? defaultValue : this.ShipCity);
			if (field == FieldNameConstants.ShipCountry)
				return ((this.ShipCountry == null) ? defaultValue : this.ShipCountry);
			if (field == FieldNameConstants.ShipName)
				return ((this.ShipName == null) ? defaultValue : this.ShipName);
			if (field == FieldNameConstants.ShippedDate)
				return ((this.ShippedDate == null) ? defaultValue : this.ShippedDate);
			if (field == FieldNameConstants.ShipPostalCode)
				return ((this.ShipPostalCode == null) ? defaultValue : this.ShipPostalCode);
			if (field == FieldNameConstants.ShipRegion)
				return ((this.ShipRegion == null) ? defaultValue : this.ShipRegion);
			if (field == FieldNameConstants.ShipVia)
				return ((this.ShipVia == null) ? defaultValue : this.ShipVia);
			throw new Exception("Field '" + field.ToString() + "' not found!");
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		public int GetInteger(Acme.Northwind.EFDAL.Entity.OrdersQry.FieldNameConstants field)
		{
			return this.GetInteger(field, int.MinValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		public int GetInteger(Acme.Northwind.EFDAL.Entity.OrdersQry.FieldNameConstants field, int defaultValue)
		{
			var o = this.GetValue(field, defaultValue);
			if (o is string)
			{
				int a;
				if (int.TryParse((string)o, out a))
					return a;
				else
					throw new System.InvalidCastException();
			}
			else
			{
				return (int)o;
			}
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		public double GetDouble(Acme.Northwind.EFDAL.Entity.OrdersQry.FieldNameConstants field)
		{
			return this.GetDouble(field, double.MinValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		public double GetDouble(Acme.Northwind.EFDAL.Entity.OrdersQry.FieldNameConstants field, double defaultValue)
		{
			var o = this.GetValue(field, defaultValue);
			if (o is string)
			{
				double a;
				if (double.TryParse((string)o, out a))
					return a;
				else
					throw new System.InvalidCastException();
			}
			else
			{
				return (double)o;
			}
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		public System.DateTime GetDateTime(Acme.Northwind.EFDAL.Entity.OrdersQry.FieldNameConstants field)
		{
			return this.GetDateTime(field, System.DateTime.MinValue);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		public System.DateTime GetDateTime(Acme.Northwind.EFDAL.Entity.OrdersQry.FieldNameConstants field, System.DateTime defaultValue)
		{
			var o = this.GetValue(field, defaultValue);
			if (o is string)
			{
				System.DateTime a;
				if (System.DateTime.TryParse((string)o, out a))
					return a;
				else
					throw new System.InvalidCastException();
			}
			else
			{
				return (System.DateTime)o;
			}
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		public string GetString(Acme.Northwind.EFDAL.Entity.OrdersQry.FieldNameConstants field)
		{
			return this.GetString(field, string.Empty);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		public string GetString(Acme.Northwind.EFDAL.Entity.OrdersQry.FieldNameConstants field, string defaultValue)
		{
			var o = this.GetValue(field, defaultValue);
			if (o is string)
			{
				return (string)o;
			}
			else
			{
				return o.ToString();
			}
		}

		#endregion

		#region GetDatabaseFieldName

		/// <summary>
		/// Returns the actual database name of the specified field.
		/// </summary>
		internal static string GetDatabaseFieldName(OrdersQry.FieldNameConstants field)
		{
			return GetDatabaseFieldName(field.ToString());
		}

		/// <summary>
		/// Returns the actual database name of the specified field.
		/// </summary>
		internal static string GetDatabaseFieldName(string field)
		{
			switch (field)
			{
				case "Address": return "Address";
				case "City": return "City";
				case "CompanyName": return "CompanyName";
				case "Country": return "Country";
				case "CustomerID": return "CustomerID";
				case "EmployeeID": return "EmployeeID";
				case "Freight": return "Freight";
				case "OrderDate": return "OrderDate";
				case "OrderID": return "OrderID";
				case "PostalCode": return "PostalCode";
				case "Region": return "Region";
				case "RequiredDate": return "RequiredDate";
				case "ShipAddress": return "ShipAddress";
				case "ShipCity": return "ShipCity";
				case "ShipCountry": return "ShipCountry";
				case "ShipName": return "ShipName";
				case "ShippedDate": return "ShippedDate";
				case "ShipPostalCode": return "ShipPostalCode";
				case "ShipRegion": return "ShipRegion";
				case "ShipVia": return "ShipVia";
			}
			return string.Empty;
		}

		#endregion

	}

}

